﻿namespace CoreEx.Database.Client
{
    /// <summary>
    /// Provides information about a configured database connection
    /// </summary>
    public class DbConnectionInfo 
    {             
        #region IConnectionInfo Members

        /// <summary>
        /// Gets or sets the name of the connection
        /// </summary>
        /// <value></value>
        public string Name { get; set;}

        /// <summary>
        /// Gets or sets the invariant name of the provider.
        /// </summary>
        /// <value></value>
        public string ProviderName { get; set;}

        /// <summary>
        /// Gets or sets The connection string that is used to access the database
        /// </summary>
        /// <value></value>
        public string ConnectionString { get; set;}

        /// <summary>
        /// Returns a <see cref="string"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="string"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            if (!string.IsNullOrEmpty(ConnectionString))            
                return ConnectionString;            
            return base.ToString();
        }

        #endregion
    }
}
